package com.lhd.controller;

import com.lhd.pojo.Inform;
import com.lhd.pojo.Result;
import com.lhd.service.InformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/inform")
public class InformController {
    @Autowired
    InformService informService;
    @GetMapping()
    public Result getInform(){
        List<Inform> informs = informService.getAll();
        return Result.success(informs);
    }
    @PutMapping
    public Result update(@RequestBody Inform inform){
        informService.update(inform);
        return Result.success();
    }
    @DeleteMapping
    public Result delete(Integer id){
        informService.delete(id);
        return Result.success();
    }
    @PostMapping
    public Result add(@RequestBody Inform inform){
        System.out.println(inform);
        informService.add(inform);
        return Result.success();
    }
}
